﻿using BoatNGoat.Server;
using SharpDX.Toolkit;

namespace BoatNGoat
{
    /// <summary>
    /// A camera controller which makes the camera follow a target IMobile.
    /// </summary>
    class FollowTargetCameraController : ICameraController
    {
        public Camera Camera { set; private get; }

        /// <summary>
        /// The target to follow. If this is set to null, the controller will stop moving the camera.
        /// </summary>
        public IMobile Target { set; private get; }

        public void Update(GameTime gameTime)
        {
            if (Target != null && Camera != null)
            {
                Camera.ViewCentre = Target.Position;
                Camera.Zoom = 1.0;
            }
            
        }
    }
}